export const tableColumnsData = [
  {
    caption: '商品编码',
    dataField: 'productCode',
    alignment: 'left',
    width: 150,
    fixed: true,

    // minWidth: 100,
  },
  {
    caption: '商品名称',
    dataField: 'productName',
    alignment: 'left',
    // width: 'auto',
    minWidth: 120,
    fixed: true,
    dataTypeCustom: 'zh-string',
  },
  {
    caption: '商品类别',
    dataField: 'typeName',
    alignment: 'left',
    // width: 200,
    dataTypeCustom: 'zh-string',
    minWidth: 100,
  },
  {
    caption: '基本计量单位',
    dataField: 'baseUnitCode',
    alignment: 'left',
    width: 100,
    dataTypeCustom: 'zh-string',
    // minWidth: 100,
  },
];

export const tableColumnsDataLog = [
  {
    caption: '批次',
    dataField: 'lotNumber',
    alignment: 'left',
    width: 80,
    // minWidth: 100,
  },
];

export const tableColumnsStore = [
  {
    caption: '库存计量单位',
    dataField: 'INVUnitCode',
    alignment: 'left',
    dataTypeCustom: 'zh-string',
    width: 100,
    // minWidth: 100,
  },
];

export const tableColumnsValuationTesting = [
  ...tableColumnsData,
  {
    caption: '计价方式',
    dataField: 'AuditTestCostMehthod',
    alignment: 'left',
    width: 100,
  },
  {
    caption: '本期生产（或购入）',
    alignment: 'center',
    columns: [
      {
        caption: '数量',
        alignment: 'right',
        dataField: 'inQTY',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
      {
        caption: '单价',
        alignment: 'right',
        dataField: 'inPrice',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
      {
        caption: '金额',
        alignment: 'right',
        dataField: 'inJE',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
    ],
  },
  {
    caption: '本期销售（或发出）',
    alignment: 'center',
    columns: [
      {
        caption: '数量',
        alignment: 'right',
        dataField: 'outQTY',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
      {
        caption: '单价',
        alignment: 'right',
        dataField: 'outPrice',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
      {
        caption: '金额',
        alignment: 'right',
        dataField: 'outJE',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
    ],
  },
  {
    caption: '期末结存',
    alignment: 'left',
    columns: [
      {
        caption: '数量',
        alignment: 'right',
        dataField: 'QMQTY',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
      {
        caption: '单价',
        alignment: 'right',
        dataField: 'QMPrice',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
      {
        caption: '金额',
        alignment: 'right',
        dataField: 'QMYE',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
    ],
  },
  {
    caption: '应结存',
    dataField: 'INVUnitCode',
    alignment: 'left',
    columns: [
      {
        caption: '数量',
        alignment: 'right',
        dataField: 'Qty_Cal',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
      {
        caption: '单价',
        alignment: 'right',
        dataField: 'CalPrice',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
      {
        caption: '金额',
        alignment: 'right',
        dataField: 'Balance_Cal',
        width: 120,
        dataType: 'number',
        dataTypeCustom: 'money-number',
      },
    ],
  },
  {
    caption: '差异',
    dataField: 'diff',
    alignment: 'left',
    width: 'auto',
  },
];

export const buildCol = (arr: string[], type = '年') => {
  return arr.map((a: any) => {
    return {
      caption: `${a}${type}`,
      alignment: 'center',
      columns: [
        {
          caption: `入库`,
          alignment: 'center',
          columns: [
            {
              caption: `数量`,
              alignment: 'right',
              dataField: `${a}_inQty`,
              dataType: 'number',
              dataTypeCustom: 'money-number',
              width: 120,
            },
            {
              caption: `金额`,
              alignment: 'right',
              dataField: `${a}_inJE`,
              dataType: 'number',
              dataTypeCustom: 'money-number',
              width: 120,
            },
          ],
        },
        {
          caption: `出库`,
          alignment: 'center',
          columns: [
            {
              caption: `数量`,
              alignment: 'right',
              dataField: `${a}_outQty`,
              dataType: 'number',
              width: 120,
              dataTypeCustom: 'money-number',
            },
            {
              caption: `金额`,
              alignment: 'right',
              dataType: 'number',
              dataField: `${a}_outJE`,
              dataTypeCustom: 'money-number',
              width: 120,
            },
          ],
        },
        {
          caption: `结余`,
          alignment: 'center',
          columns: [
            {
              caption: `数量`,
              alignment: 'right',
              dataType: 'number',
              dataField: `${a}_Qty`,
              width: 120,
              dataTypeCustom: 'money-number',
            },
            {
              caption: `金额`,
              alignment: 'right',
              dataField: `${a}_Cost`,
              dataType: 'number',
              width: 120,
              dataTypeCustom: 'money-number',
            },
          ],
        },
      ],
    };
  });
};
